home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 358 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  53 lines

  1. Path: gramercy.ios.com!lalit
  2. From: lalit@gramercy.ios.com (lalit gidwani)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Copying StdInput to StdOuput
  5. Date: 4 Jan 1996 02:09:20 GMT
  6. Organization: Internet Online Services
  7. Distribution: world
  8. Message-ID: <4cfcsg$keo@news2.ios.com>
  9. References: <CHN.96Jan3100905@alc.alc.ping.de>
  10. NNTP-Posting-Host: gramercy.ios.com
  11. X-Newsreader: TIN [version 1.2 PL2]
  12.  
  13. Christian Neise (chn@alc.ping.de) wrote:
  14.  
  15. : Hello!
  16.  
  17. : Sorry for this newbie-question:
  18.  
  19. : I want to write a filterprogramm under linux, which copies the
  20. : modified standardinput to standardouput.
  21.  
  22. : I tried:
  23.  
  24. : #include <iostream.h>
  25.  
  26. : void main(){
  27. : char buf[200];
  28. : while (!cin.eof())
  29. :       { cin >> buf; // or: cin.get(buf, 200, '\n');
  30. :         cout << buf;
  31. :       }
  32. : }
  33.  
  34. : I compiled this as test and tried: cat AnyTextfile | test
  35. : and I expected to see AnyTextfile on the screen. But it
  36. : didn't work. 
  37.  
  38. : What's the problem?
  39.  
  40. : Thanks in advance for any help!
  41.  
  42. : Ciao,
  43. : Christian.
  44.  
  45.  
  46.  
  47. :     
  48. : -- 
  49. : Christian Neise 
  50. : ---------------
  51. : email:  chn@alc.ping.de              phone: +49 - 231 - 751 95 22
  52. : pgp-fingerprint: DE B0 C8 EF 42 44 4F 50  2C 2E DC 19 F5 71 65 83
  53.